home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / bin / compiz-decorator < prev    next >
Encoding:
Text File  |  2009-05-01  |  3.1 KB  |  102 lines

  1. #!/bin/sh
  2. # Starts Compiz Decorator depending on the DE
  3. # Copyright (c) 2007 CyberOrg <cyberorg@cyberorg.info>
  4. # Based on compiz-manager script by Kristian Lyngst√∏l <kristian@bohemians.org>
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  19. #
  20. # Contributions by: crdlb
  21. #
  22. COMPIZ_BIN_PATH=/usr/bin/
  23. KWIN=`which kwin`
  24. METACITY="/usr/bin/metacity"
  25.  
  26. #
  27. # Default to gtk/kde(4)-window-decorator
  28. #
  29. USE_EMERALD="no"
  30. DECORATOR=""
  31.  
  32. #Do not leave users without decoration if decorator fails
  33. if [ "$DESKTOP_SESSION" = "kde" ]; then
  34.     FALLBACKWM="${KWIN}"
  35. else
  36.     FALLBACKWM="${METACITY}"
  37. fi
  38. FALLBACKWM_OPTIONS=" --replace"
  39.  
  40. #
  41. # Set to yes to enable verbose
  42. #
  43. VERBOSE="yes"
  44.  
  45. #
  46. # Echos the arguments if verbose
  47. #
  48. verbose()
  49. {
  50.     if [ "x$VERBOSE" = "xyes" ]; then
  51.         printf "$*"
  52.     fi
  53. }
  54.  
  55. # Read configuration from XDG paths
  56. if [ -z "$XDG_CONFIG_DIRS" ]; then
  57.     test -f /etc/xdg/compiz/compiz-manager && . /etc/xdg/compiz/compiz-manager
  58. else
  59.     test -f $XDG_CONFIG_DIRS/compiz/compiz-manager && . $XDG_CONFIG_DIRS/compiz/compiz-manager
  60. fi
  61.  
  62. if [ -z "$XDG_CONFIG_HOME" ]; then
  63.     test -f $HOME/.config/compiz/compiz-manager && . $HOME/.config/compiz/compiz-manager
  64. else
  65.     test -f $XDG_CONFIG_HOME/compiz/compiz-manager && .  $XDG_CONFIG_HOME/compiz/compiz-manager
  66. fi
  67.  
  68. # start a decorator
  69. if [ -x ${COMPIZ_BIN_PATH}emerald ] && [ "$USE_EMERALD" = "yes" ]; then
  70.     DECORATOR=emerald
  71. elif [ -x ${COMPIZ_BIN_PATH}gtk-window-decorator ] && [ -n "$GNOME_DESKTOP_SESSION_ID" ]; then
  72.     DECORATOR=gtk-window-decorator
  73. elif [ -x ${COMPIZ_BIN_PATH}kde-window-decorator ] && [ -n "$KDE_FULL_SESSION" ]; then
  74.     DECORATOR=kde-window-decorator
  75. elif [ -x ${COMPIZ_BIN_PATH}kde4-window-decorator ] && [ x$KDE_SESSION_VERSION = x"4" ]; then
  76.     DECORATOR=kde4-window-decorator
  77. fi
  78.  
  79. # fall back to any decorator that is installed
  80. if [ -z "$DECORATOR" ]; then
  81.     verbose "Couldn't find a perfect decorator match; trying all decorators\n"
  82.     if [ -x ${COMPIZ_BIN_PATH}emerald ]; then
  83.         DECORATOR=emerald
  84.     elif [ -x ${COMPIZ_BIN_PATH}gtk-window-decorator ]; then
  85.     DECORATOR=gtk-window-decorator
  86.     elif [ -x ${COMPIZ_BIN_PATH}kde-window-decorator ]; then
  87.     DECORATOR=kde-window-decorator
  88.     elif [ -x ${COMPIZ_BIN_PATH}kde4-window-decorator ]; then
  89.     DECORATOR=kde4-window-decorator
  90.     fi
  91. fi
  92.  
  93. if [ -n "$DECORATOR" ]; then
  94.     verbose "Starting ${DECORATOR}\n"
  95.     ${COMPIZ_BIN_PATH}$DECORATOR "$@"
  96. else
  97.     verbose "Found no decorator to start\n"
  98.     exec $FALLBACKWM $FALLBACKWM_OPTIONS
  99. fi
  100.  
  101.